import time

from page_object.pages.BasePage import BasePage
from page_object.pages.MainPage import MainPage
from selenium.webdriver.common.by import By


class PasswordPage(BasePage):
    _verificationcodeinput = (By.ID, 'verificationcodeinput')
    def input_password(self, password):
        #todo: 不通，根据XPATH输入不了
        a = self.find_contain_by_xpath('请输入').click()
        time.sleep(2)
        a.send_keys(password)
        self.find_by_xpath('登录').click()

        return MainPage()

    def verification_code_login(self):
        '''
        输入验证码
        :return:首页
        '''
        self.find_by_xpath('验证码登录').click()
        self.find(self._verificationcodeinput).send_keys(9999)
        return MainPage()

